package com.sherlocky.base;

import java.io.FileNotFoundException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Log4jConfigurer;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:conf/AppApplicationContext.xml", "classpath:conf/AppApplicationContext-shiro.xml"})
//@TransactionConfiguration(transactionManager="transactionManager")
//@Transactional
public class BaseSpringTestCase {
	private long start = 0;
	private long end = 0;
	protected Log logger = LogFactory.getLog(getClass());
	
	static{
		try {
			Log4jConfigurer.initLogging("classpath:log4j_test.properties");
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}
	
	@Before
	public void before() {
		start = System.currentTimeMillis();
	}
	
	@After
	public void end() {
		end = System.currentTimeMillis();
		System.out.println("方法执行完毕，总耗时：" + (end-start) + "ms");
	}
}